package dfsketches.pathfind;

import java.util.HashSet;

/**
 * A class to find paths for creatures, store them, modify and do some related work.
 */
public interface PathManager {
	/**
	 * Finds path for specified creature from one point to other.
	 * @param creature
	 * @param x_from
	 * @param y_from
	 * @param x_to
	 * @param y_to
	 * @return	ID of path have been found.
	 */
	public int findPath(Creature creature, int x_from, int y_from, int x_to, int y_to);

	/**
	 * Removes from set of x*h+y of points all unreachable for specified creature points.
	 * @param creature
	 * @param x
	 * @param y
	 * @param set
	 */
	public void removeUnreachable(Creature creature, int x, int y, HashSet<Integer> set);
	
	/**
	 * Finds closest point from set.
	 * @param creature
	 * @param x
	 * @param y
	 * @param set	set of x*h+y of points
	 * @return 	x*h+y of closest points in set
	 */
	public int findClosest(Creature creature, int x, int y, HashSet<Integer> set);	

	/**
	 * Returns x*h+y for next tile in path with given ID.
	 * @param id
	 * @return
	 */
	public int nextStep(int id);
	
	/**
	 * Deletes path with given ID.
	 * @param id
	 */
	public void deletePath(int id);
	
	/**
	 * Deletes this path if it is invalid or the shorter one exists and creates another with the same id.
	 * @param id
	 */
	public void updatePath(int id);
}